/*
 * This file is part of FinVis.
 *
 * FinVis is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * FinVis is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with FinVis.  If not, see <http://www.gnu.org/licenses/>
 *
 * @author Stephen Rudolph
 */

#ifndef FIN_LIST_H
#define FIN_LIST_H

#include <QDockWidget>
#include "FinInvestment.h"

class QModelIndex;
class QPushButton;
class QStandardItemModel;
class QTableView;

/**
 * This widget displays a list of all added investments and allows the user to
 * add more or remove existing ones.
 */
class FinList : public QDockWidget {
Q_OBJECT

public:
    FinList(QWidget *parent = 0, Qt::WindowFlags flags = 0);

    QSize minimumSizeHint() const;
    QSize sizeHint() const;

    void enableButtons();
    void disableButtons();

    void reset();
signals:
    void addAndSelectInvestment();
    void removeSelectedInvestment();
    void selectionChanged(unsigned int investmentID);
private slots:
    void currentRowChanged(const QModelIndex &i);
public slots:
    void portfolioDataChanged();
    void selectionChanged();
private:
    bool m_loading;
    QSize m_widgetSize;
    QPushButton *m_addInvestment, *m_removeInvestment;
    QStandardItemModel *m_model;
    QTableView *m_investmentVectorView;
    QWidget *m_listWidget;
};

#endif
